#!/usr/bin/python3
# -*- coding: utf-8 -*-
# @Author : Tinfeng

import re
import os
import time

from handle.LoginHandle import LoginHandle
from utils.Logger import Logger


logger = Logger(logger='LoginBusiness').getlog()

class LoginBusiness:
    def __init__(self,i):
        self.loginHandle = LoginHandle(i)

    def loginMethod(self):
        '''
        车分期测试环境登录流程
        :return:
        '''
        self.loginHandle.sendUsername()
        self.loginHandle.sendPassword()
        self.loginHandle.sendCaptcha()
        self.loginHandle.clickLogin()
        self.loginHandle.clickRoleBox()
        self.loginHandle.choiceRole()
        self.loginHandle.clickSure()

        # self.loginHandle.clickDkdOuter()
        # self.loginHandle.clickDkdInner()

    def loansMethod(self):
        '''
        贷款单流程
        :return:
        '''
        self.loginHandle.clickDkdOuter()
        self.loginHandle.clickDkdInner()
        # 切换iframe
        self.loginHandle.switchIframe('LOAN_LST')
        self.loginHandle.sendDkdNum()
        self.loginHandle.clickSearch()
        self.loginHandle.clickOnList()
        self.loginHandle.clickListInfo()
        logger.info("点击详情")
